package megrez.bussiness.system.web.dto;

import java.util.ArrayList;
import java.util.List;

import lombok.Data;
import megrez.bussiness.system.entity.Dict;
import megrez.bussiness.system.web.mapper.DictDetailMapper;
import megrez.bussiness.system.web.mapper.DictMapper;

/**
 * 字典明细平面传输对象
 * 
 * @author Lucky Yang
 * @since 0.0.1
 */
@Data
public class DictFlatDto {
    private DictDto dict;
    private List<DictDetailDto> details = new ArrayList<>();

    public static DictFlatDto of(Dict source) {
        DictFlatDto rslt = new DictFlatDto();

        rslt.setDict(DictMapper.INST.toDto(source));
        rslt.setDetails(DictDetailMapper.INST.toDto(source.getDetails()));
        return rslt;
    }
}
